unit uFrmRadioOption;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, uCxtForm;

type
  TFrmRadioOption = class(TBaseForm)
    Panel1: TPanel;
    rgOptions: TRadioGroup;
    btnOK: TButton;
    btnCancel: TButton;
  end;

function GetOption(const Title: string; const Options: array of string;
  DefSelected: Integer = 0): Integer;

implementation

{$r *.dfm}

var
  FrmRadioOption: TFrmRadioOption;

function GetOption(const Title: string; const Options: array of string;
  DefSelected: Integer): Integer;
var
  i: Integer;
begin
  if not Assigned(FrmRadioOption) then
    Application.CreateForm(TFrmRadioOption, FrmRadioOption);
  FrmRadioOption.Caption := Title;
  FrmRadioOption.rgOptions.Items.Clear;
  for i := Low(Options) to High(Options) do
    FrmRadioOption.rgOptions.Items.Add(Options[i]);
  FrmRadioOption.rgOptions.ItemIndex := DefSelected;
  if FrmRadioOption.ShowModal = mrOk then
    Result := FrmRadioOption.rgOptions.ItemIndex
  else Result := -1;
end;

end.
